package com.ty.tymusic.controller;

import com.ty.tymusic.dto.request.TokenCreateRequestBody;
import com.ty.tymusic.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/tokens")
@Api(tags = "token接口")
public class TokenController {

    UserService userService;

    @PostMapping
    @ApiOperation("创建token")
    String createToken(@RequestBody TokenCreateRequestBody tokenCreateRequestBody) {
        return userService.createToken(tokenCreateRequestBody);
    }

    @Autowired
    private void setUserService(UserService userService) {
        this.userService = userService;
    }
}
